package com.myproject.myapp.controller;

import javax.inject.Inject;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.myproject.myapp.service.MariaService;
import com.myproject.myapp.vo.MariaVo;

@Controller
public class MariaController {

	/*@Autowired
	private MariaService mariaService;*/
	
	@Inject
	private MariaService mariaService;
	
	@RequestMapping(value="/add", method=RequestMethod.GET)
	public String write(
			Model model, 
			MariaVo mariaVo
			){
		
		model.addAttribute("msg", "GET");

		return "write";
	}
	
	@RequestMapping(value="/add", method=RequestMethod.POST)
	public String add(
			@ModelAttribute MariaVo mariaVo,
			Model model
			//MariaVo mariaVo
			){

		/*mariaVo.setName("bush");
		mariaVo.setPhone("013");
		mariaVo.setAddress("guro");*/
		
		//mariaService.add(mariaVo);
		model.addAttribute("msg", "POST");
		
		return "insert";
	}
	
}
